package com.bbzn.device.client.service.impl;

import com.bbzn.device.client.dto.device.CreateNbDeviceDTO;
import com.bbzn.device.client.dto.device.DeviceCategoryDTO;
import com.bbzn.device.client.utils.PageInfo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.bbzn.device.client.dataobject.DeviceCategory;
import com.bbzn.device.client.dao.device.DeviceCategoryMapper;
import com.bbzn.device.client.service.DeviceCategoryService;

@Service
public class DeviceCategoryServiceImpl implements DeviceCategoryService {

    @Resource
    private DeviceCategoryMapper deviceCategoryMapper;

    @Override
    public int deleteByPrimaryKey(Long id) {
        return deviceCategoryMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(DeviceCategory record) {
        return deviceCategoryMapper.insert(record);
    }

    @Override
    public int insertOrUpdate(DeviceCategory record) {
        return deviceCategoryMapper.insertOrUpdate(record);
    }

    @Override
    public int insertOrUpdateSelective(DeviceCategory record) {
        return deviceCategoryMapper.insertOrUpdateSelective(record);
    }

    @Override
    public int insertSelective(DeviceCategory record) {
        return deviceCategoryMapper.insertSelective(record);
    }

    @Override
    public DeviceCategory selectByPrimaryKey(Long id) {
        return deviceCategoryMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(DeviceCategory record) {
        return deviceCategoryMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(DeviceCategory record) {
        return deviceCategoryMapper.updateByPrimaryKey(record);
    }

    @Override
    public int updateBatch(List<DeviceCategory> list) {
        return deviceCategoryMapper.updateBatch(list);
    }

    @Override
    public int batchInsert(List<DeviceCategory> list) {
        return deviceCategoryMapper.batchInsert(list);
    }

    @Override
    public List<DeviceCategory> findByAll(DeviceCategory deviceCategory) {
        return deviceCategoryMapper.findByAll(deviceCategory);
    }

    @Override
    public int updateBatchSelective(List<DeviceCategory> list) {
        return deviceCategoryMapper.updateBatchSelective(list);
    }

    @Override
    public int findCountByAll(DeviceCategoryDTO record) {
        return deviceCategoryMapper.findCountByAll(record);
    }

    @Override
    public PageInfo<DeviceCategory> selectPageByAll(DeviceCategoryDTO record) {
        PageInfo<DeviceCategory> pageInfo = new PageInfo<>();
        pageInfo.setPageNum(record.getPageNum());
        pageInfo.setPageSize(record.getPageSize());
        pageInfo.setResultList(deviceCategoryMapper.selectPageByAll(record));
        int count = deviceCategoryMapper.findCountByAll(record);
        pageInfo.setTotalRecord(count);
        return pageInfo;
    }

    @Override
    public CreateNbDeviceDTO queryNbParam(Long deviceCategoryId) {
        return deviceCategoryMapper.queryNbParam(deviceCategoryId);
    }

    @Override
    public List<DeviceCategory> selectByAll(DeviceCategory deviceCategory) {
        return deviceCategoryMapper.selectByAll(deviceCategory);
    }
}



